
<template>
  <van-tabbar v-model="active" active-color="#ff5f16" inactive-color="#797d82">
    <van-tabbar-item replace name="/recommend" to="/recommend">
      <span>推荐</span>
      <template #icon="props">
        <booksIcon :class="'icon-tuijian'" />
      </template>
    </van-tabbar-item>
    <van-tabbar-item replace name="/bookStore" to="/bookStore">
      <span>书架</span>
      <template #icon="props">
        <booksIcon :class="'icon-shujia'"/>
      </template>
    </van-tabbar-item>
    <van-tabbar-item replace name="/bookCity" to="/bookCity">
      <span>书城</span>
      <template #icon="props">
        <booksIcon :class="'icon-chengshi'" />
      </template>
    </van-tabbar-item>
    <van-tabbar-item replace name="/bookMusic" to="/bookMusic">
      <span>听书</span>
      <template #icon="props">
        <booksIcon :class="'icon-erji'" />
      </template>
    </van-tabbar-item>
    <van-tabbar-item replace name="/aboutMine" to="/aboutMine">
      <span>我的</span>
      <template #icon="props">
        <booksIcon :class="'icon-31wode'" />
      </template>
    </van-tabbar-item>
  </van-tabbar>
</template>

<script>
export default {
  data() {
    return {
      active:'/',
    };
  },
  watch:{
    "$route.path": {
      immediate: true,
      handler(url) {
        this.active = "/" + url.split('/')[1]
      },
    },
  }
};
</script>


<style lang="scss" scoped></style>